package com.software.form.cargobooking.dao;

import java.util.List;

public class CargoBookingTransaction {
	private CargoBookingDao cargoBookingDao;

	public CargoBookingDao getCargoBookingDao() {
		return cargoBookingDao;
	}

	public void setCargoBookingDao(CargoBookingDao cargoBookingDao) {
		this.cargoBookingDao = cargoBookingDao;
	}
	
	public boolean add(String no,String shipper,String shipper_addr,String con,String dest,String con_addr,
			String departure,String spec,String name,String pieces,String weight,String m3,String charges,
			String semail,String saemail){
		CargoBooking cb = new CargoBooking();
		cb.setNo(no);
		cb.setShipper(shipper);
		cb.setShipperAddress(shipper_addr);
		cb.setConsignee(con);
		cb.setConsigneeAddress(con_addr);
		cb.setDestination(dest);
		cb.setDeparture(departure);
		cb.setSpecialInstructions(spec);
		cb.setCargoName(name);
		cb.setWeight(weight);
		cb.setPieces(pieces);
		cb.setVolume(m3);
		cb.setCharges(charges);
		cb.setShipperEmail(semail);
		cb.setSagentEmail(saemail);
		cb.setStatus(0);
		return cargoBookingDao.add(cb);
	}
	
	public List<CargoBooking> getCargoBySagentEmail(String email){
		return cargoBookingDao.queryBySagentEmail(email);
	}
	
	public CargoBooking getCargoByNo(String no){
		return cargoBookingDao.queryByNo(no);
	}
	
	public boolean updateCargoStatus(String no,int status){
		return cargoBookingDao.updateStatus(no, status);
	}
}
